Skip to content

src: add option to hide internal stack frames - #67715

Open
jasnell wants to merge 2 commits into
nodejs:mainfrom
jasnell:jasnell/option-to-hide-internal-stack-frames
Open

jasnell wants to merge 2 commits into
nodejs:mainfrom
jasnell:jasnell/option-to-hide-internal-stack-frames

Conversation

@jasnell

@jasnell jasnell commented Nov 22, 2026

Copy link
Copy Markdown
Member

By default, when node.js prints a stack it includes all of the
node:internal frames. This make the output more verbose but
it's often providing extraneous detail the user can't do
anything about. This adds a cli flag to hide those details.
It can be set in NODE_OPTIONS.

$ node --hide-internal-stack-frames -e "require('node:fs').readFileSync('missing')"
Error: ENOENT: no such file or directory, open 'missing'
    at Object.openSync (node:fs:779:18)
    at Object.readFileSync (node:fs:625:35)
    at [eval]:1:20
    at <node:internal> (7 frames hidden) {

Also fixes a latent bug in the node_report.cc

By default, when node.js prints a stack it includes all of the
`node:internal` frames. This make the output more verbose but
it's often providing extraneous detail the user can't do
anything about. This adds a cli flag to hide those details.
It can be set in NODE_OPTIONS.

```console
$ node --hide-internal-stack-frames -e "require('node:fs').readFileSync('missing')"
...
Error: ENOENT: no such file or directory, open 'missing'
    at Object.openSync (node:fs:779:18)
    at Object.readFileSync (node:fs:625:35)
    at [eval]:1:20
    at <node:internal> (7 frames hidden) {
...
```

Signed-off-by: James M Snell <jasnell@gmail.com>
Assisted-by: Claude
The loop that splits error.stack into the report's
javascriptStack.stack only emitted a line once it
found the following newline, so the final frame was
always dropped.

Signed-off-by: James M Snell <jasnell@gmail.com>
Assisted-By: Claude
@jasnell jasnell added the semver-minor PRs that contain new features and should be released in the next minor version. label Nov 22, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/config

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. labels Nov 22, 2026
@codecov

codecov Bot commented Nov 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.56962% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.53%. Comparing base (a16ff8b) to head (978f658).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/node_report.cc 76.92% 4 Missing and 2 partials ⚠️
src/node_errors.cc 96.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67715      +/-   ##
==========================================
- Coverage   90.53%   90.53%   -0.01%     
==========================================
  Files         801      801              
  Lines      284113   284251     +138     
  Branches    54874    54904      +30     
==========================================
+ Hits       257230   257348     +118     
  Misses      17057    17057              
- Partials     9826     9846      +20     
Files with missing lines Coverage Δ
lib/internal/errors.js 98.18% <100.00%> (+0.06%) ⬆️
lib/internal/process/pre_execution.js 96.63% <100.00%> (+0.37%) ⬆️
lib/internal/util/inspect.js 97.03% <100.00%> (+<0.01%) ⬆️
src/node_internals.h 82.25% <ø> (ø)
src/node_options.cc 88.25% <100.00%> (+0.01%) ⬆️
src/node_options.h 95.78% <100.00%> (+0.01%) ⬆️
src/node_watchdog.cc 79.83% <100.00%> (+0.51%) ⬆️
src/node_errors.cc 65.36% <96.66%> (+1.12%) ⬆️
src/node_report.cc 91.57% <76.92%> (-0.83%) ⬇️

... and 35 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jasnell
jasnell requested review from BridgeAR and mcollina November 23, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. semver-minor PRs that contain new features and should be released in the next minor version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants